#ifndef _SHARESUM_H
#define _SHARESUM_H

#include <pthread.h>
#include "globalerror.h"

static int count = 0;
static double sum = 0.0;
static pthread_mutex_t sumlock = PTHREAD_MUTEX_INITIALIZER;

/* 将x添加到sum中 */
int add(double x);

/* 返回sum */
int getsum(double *sump);

/* 返回count和sum */
int getcountandsum(int *countp, double *sump);

#endif